package sunbao.ido.experimentalField;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
import sunbao.ido.experimentalField.service.Rectangle;

/**
 * \* User: MeiZhongHao
 * \* Date: 2018-11-09
 * \* Time: 14:07
 * \* Description:
 * \
 */
public class MyImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {

    @Override
    public void registerBeanDefinitions(AnnotationMetadata annotationMetadata, BeanDefinitionRegistry beanDefinitionRegistry) {
        // new一个RootBeanDefinition
        RootBeanDefinition rootBeanDefinition = new RootBeanDefinition(Rectangle.class);
        // 注册一个名字叫rectangle的bean
        beanDefinitionRegistry.registerBeanDefinition("rectangle", rootBeanDefinition);
    }
}